package com.lianzhihui.romeex.utils.fingersafe;

import android.content.ComponentName;
import android.content.Intent;
import android.os.Build;
import android.provider.Settings;
import android.text.TextUtils;

import com.lianzhihui.romeex.MyApplication;

import java.util.concurrent.PriorityBlockingQueue;

/**
 * @ProjectName: romeex
 * @Package: com.lianzhihui.romeex.utils.fingersafe
 * @ClassName: SystemIntentUtils
 * @Description: java类作用描述
 * @Author: zhanghong
 * @CreateDate: 2020/11/5 15:06
 * @UpdateUser: 更新者：
 * @UpdateDate: 2020/11/5 15:06
 * @UpdateRemark: 更新说明：
 * @Version: 1.0
 */
public class SystemIntentUtils {


    public static void FingerSetting() {
        String brand = android.os.Build.BRAND;
        if (TextUtils.equals(brand.toLowerCase(), "redmi") || TextUtils.equals(brand.toLowerCase(), "xiaomi")) {
            //小米
            Intent intent = new Intent();
            String pcgName = "com.android.settings";
            String clsName = "com.android.settings.NewFingerprintActivity";
            ComponentName componentName = new ComponentName(pcgName, clsName);
            intent.setComponent(componentName);
            intent.setAction("android.settings.FINGERPRINT_SETUP");
            MyApplication.mContext.startActivity(intent);
        } else if (TextUtils.equals(brand.toLowerCase(), "meizu")) {
            //魅族
        } else if (TextUtils.equals(brand.toLowerCase(), "huawei") || TextUtils.equals(brand.toLowerCase(), "honor")) {
            //华为
            Intent intent = new Intent();
            String pcgName = "com.android.settings";
            String clsName = "com.android.settings.fingerprint.FingerprintSettingsActivity";
            ComponentName componentName = new ComponentName(pcgName, clsName);
            intent.setAction(Intent.ACTION_VIEW);
            intent.setComponent(componentName);
            MyApplication.mContext.startActivity(intent);
        } else if (TextUtils.equals(brand.toLowerCase(), "oppo")) {
            //oppo
            Intent intent;
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
                intent = new Intent(Settings.ACTION_FINGERPRINT_ENROLL);
            } else {
                intent = new Intent(Settings.ACTION_SECURITY_SETTINGS);
            }
            MyApplication.mContext.startActivity(intent);
        } else {
            Intent intent = new Intent(Settings.ACTION_SETTINGS);
            MyApplication.mContext.startActivity(intent);
        }


    }

}
